﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using Project.MVC.DataAccess;
@using Project.MVC.Admin.Models;
@model CategoryModel
@*@using (Html.BeginForm("Add", "Category", FormMethod.Post, new { type = Model.Type }))*@
@using (Html.BeginForm(new { Controller = "Category", Action = "Edit", id = Model.Category.Id }))
{
    <div id="toolbar-box">
        <div class="t">
            <div class="t">
                <div class="t">
                </div>
            </div>
        </div>
        <div class="m">
            <div class="toolbar-list" id="toolbar">
                <ul>
                    <li id="toolbar-apply" class="button"><a class="toolbar" href="#"><span class="icon-32-apply"
                        title="Lưu"></span>Lưu </a></li>
                    <li id="toolbar-save" class="button"><a class="toolbar" href="#"><span class="icon-32-save"
                        title="Lưu & đóng"></span>Lưu & đóng </a></li>
                    <li id="toolbar-save-new" class="button"><a class="toolbar" href="#"><span class="icon-32-save-new"
                        title="Lưu & thêm"></span>Lưu & thêm </a></li>
                    <li class="divider"></li>
                    <li id="toolbar-cancel" class="button"><a onclick="vsw_exec_cmd(cancel)" class="toolbar"
                        href="#"><span class="icon-32-cancel" title="Đóng"></span>Đóng </a></li>
                </ul>
            </div>
            <div class="pagetitle icon-48-generic">
                <h2>
                    Nhóm sản phẩm : @(Model.Category != null && Model.Category.Id > 0 ? "Chỉnh sửa" : "Thêm mới")</h2>
            </div>
            <div class="clr">
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b">
                </div>
            </div>
        </div>
    </div>
    <div class="clr">
    </div>
    
   if(Model != null && (!string.IsNullOrEmpty(Model.Message)))
   {
    <dl id="system-message">
        <dd class="message message">
            <ul>
                <li>@Model.Message</li>
            </ul>
        </dd>
    </dl>
   }
    <div id="element-box">
        <div class="t">
            <div class="t">
                <div class="t">
                </div>
            </div>
        </div>
        <div class="m">
            <div class="width-70 fltlft" style="width: 100%">
                <fieldset class="adminform">
                    <legend>THÔNG TIN CHUNG</legend>
                    <table class="admintable">
                        <tr>
                            <td class="key">
                                <label>
                                    Nhóm sản phẩm cha :</label>
                            </td>
                            <td>
                                @Html.DropDownList("ddlParentCateId", new SelectList(Model.ParentCategories, "Id", "Name",Model.Category.ParentCategoryId), "[None]")
                            </td>
                        </tr>
                        <tr>
                            <td class="key">
                                <label>
                                    Tên :</label>
                            </td>

                            <td>
                            @Html.Hidden("txtId",Model.Category.Id)
                                <input class="text_input" value="@Model.Category.Name" name="txtName" type="text" maxlength="255" />
                            </td>
                        </tr>
                        <tr>
                            <td class="key">
                                <label>
                                    Thứ tự sắp xếp :</label>
                            </td>
                            <td>
                                <input class="text_input" value="@Model.Category.DisplayOrder" type="text" name="txtDisplayOrder" id="ProductCode" maxlength="255" />
                            </td>
                        </tr>
                        <tr align="center">
                            <td colspan="2">
                                <input type="submit" value="Lưu" />
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </div>
            @*<div class="width-30 fltrt">
            <div id="content-sliders-" class="pane-sliders">

                <div class="panel">
                    <h3 class="pane-toggler title" id="publishing-details">
                        <a href="javascript:void(0);"><span>THUỘC TÍNH</span></a></h3>
                    <div class="pane-slider content">
                         <table class="admintable">
                            <tr>
                                <td align="center" style="text-align:center" class="key">
                                   Hình minh họa
                                </td>
                            </tr>
                            <tr>
                                <td>
                                        @if (!string.IsNullOrEmpty(Model.Image))
                                          {
                                              @Project.MVC.Util.Utils.GetMedia(Model.Image, 100, 80, string.Empty, true, "id='img_view'")}
                                          else
                                          { 
                                              <img id="img_view" width="100" height="80" />
                                          }
                                        <br />
                                        <input class="text_input" type="text" name="File" id="File" style="width:65%" />
                                        <input class="text_input" style="width:75px;" type="button" onclick="ShowFileForm('File');return false;" value="Chọn ảnh" />
                                </td>
                            </tr>
                            <tr>
                                <td align="center" style="text-align:center" class="key">
                                  Chuyên mục
                                </td>
                            </tr>
                            <tr>
                                <td>
                                   <select name="MenuID" id="MenuID" class="text_input">
                                        <option value="0">Root</option>
                                       @* <%= Utils.ShowDDLMenuByType("Product", model.LangID, entity.MenuID)%>
        </select> </td> </tr>
        <tr>
            <td align="center" style="text-align: center" class="key">
                Vị trí
            </td>
        </tr>
        <tr>
            <td>
                <%= Utils.ShowCheckBoxByConfigkey("Mod.ProductState", "ArrState", entity.State)%>
            </td>
        </tr>
        @* <tr>
                                <td align="center" style="text-align:center" class="key">
                                   Còn hàng
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input name="Available" <%= entity.Available ? "checked" : "" %> type="radio" value='1' /> Có
                                    <input name="Available" <%= !entity.Available ? "checked" : "" %> type="radio" value='0' /> Không
                                </td>
                            </tr>*@ @*<%if(CPViewPage.UserPermissions.Approve) {%>*@ @*    <tr>
                                <td align="center" style="text-align:center" class="key">
                                   Duyệt
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input name="Activity" <%= entity.Activity ? "checked" : "" %> type="radio" value='1' /> Có
                                    <input name="Activity" <%= !entity.Activity ? "checked" : "" %> type="radio" value='0' /> Không
                                </td>
                            </tr>
                           @* <%} %>

                          </table>
                    </div>
                </div>
*@ @* <div class="panel">
                    <h3 class="pane-toggler title" id="basic-options">
                        <a href="javascript:void(0);"><span>THÔNG TIN THÊM</span></a></h3>
                    <div class="pane-slider content">
                        <textarea class="text_input" style="height:100px;" name="Custom" id="custom"><%=entity.Custom%></textarea>
                        <textarea class="text_input" style="height:50px;" name="set_custom" id="set_custom"></textarea>
                        <table width="99%">
                            <tr>
                                <td width="100%">
                                    <input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" checked value="Keywords" />Từ khóa
                                    <br />
                                    <input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" value="Description" />Diễn giải
                                </td>
                                <td>
                                    <input type="button" class="text_input" style="width:100px;" onclick="SetCustom(); return false;" value="Cập nhật" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

                
            </div>
        </div>*@
            <div class="clr">
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b">
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        CKFinder.setupCKEditor(null, 'http://localhost:5247/Content/ckfinder/');
    </script>
@*
<script type="text/javascript" src="/{CPPath}/Content/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    CKFinder.setupCKEditor(null, '/{CPPath}/Content/ckfinder/');

    function refreshPage(arg) {
        arg = '~' + arg;
        document.getElementById(name_control).value = arg;
        if (document.getElementById("img_view"))
            document.getElementById("img_view").src = arg.replace('~/', '/{ApplicationPath}');
    }

    GetCustom('Keywords');

</script>
*@ 
}